package com.javatiaocao.myblog.mapper;

import com.javatiaocao.myblog.model.Role;
import com.javatiaocao.myblog.model.User;
import com.javatiaocao.myblog.model.UserDTO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;


@Repository
public interface UserMapper {
     User findUserByPhone(String phone);

     void register(User user);

     UserDTO findExistUsername(String username);

     UserDTO findExistPhone(String phone);

     String findPasswordByPhone(String phone);

     void changePasswordByPhone(@Param("phone") String phone,@Param("newMD5Password") String newMD5Password);

     int getRoleIdByUid(int id);

     String getRoleByRoleId(int roleId);

    void updateRecentlyLanded(@Param("phone") String phone, @Param("recentlyLanded") String recentlyLanded);

     List<Role> getRolesByPhone(String phone);

     void updateRoleById(@Param("userId") int userId, @Param("roleId") int roleId);

    List<Role> findUserRoleByPhone(String phone);

    User selectUserById(int id);

    User getUserPersonalInfo(String phone);

    int getallUser();

    User findUserByUserName(String username);
}
